clearvars -except Globaloption option

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This code reads in the VAR dynamics and produce the Campbell-Shiller decomposition in the paper
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Load data

loaddata_4CIjoint_annual;
ttime=[1947:2020];

output_rp = 0.03;


%% Estimation
run ../../tools/cs_estimation.m

%% steady-state upper bound calculation
upper = exp(pxbar) * (mean(taxrevgdp - spendgdp));

gdpreturn = output_rp + y0nom_1 + yspr0 - pi0;

%% bootstrap
run ../../tools/BS_compute.m

save MAT/US_post1946.mat k0x k1x s upper pdX pxbar gdpreturn s std_coeff gdebt

